#!/usr/bin/env bash

if [[ -n $(command -v apt) ]]; then
  sudo apt update
  sudo apt install -y git automake libevent-dev libncurses5-dev build-essential pkg-config
elif [[ -n $(command -v yum) ]]; then
  sudo yum install -y git automake libevent-devel ncurses-devel byacc
fi

rm -fr /tmp/tmux
git clone --depth 1 --single-branch -b ${v-2.6} https://github.com/tmux/tmux.git /tmp/tmux

cd /tmp/tmux
sh autogen.sh
./configure && make
sudo make install

cd -
rm -fr /tmp/tmux
